package com.xplan.actions;

import java.util.List;

import com.xplan.pojo.TestPojo;
import com.xplan.service.TestService;

public class TestAction extends BaseAction {

	private TestService testservice;

	private List testlist;
	private TestPojo testpojo;

	public TestService getTestservice() {
		return testservice;
	}

	public void setTestservice(TestService testservice) {
		this.testservice = testservice;
	}

	public List getTestlist() {
		return testlist;
	}
	
	 
	public void setTestlist(List testlist) {
		this.testlist = testlist;
	}



	public TestPojo getTestpojo() {
		return testpojo;
	}

	public void setTestpojo(TestPojo testpojo) {
		this.testpojo = testpojo;
	}
	
	public JsonResult json(){
		
		JsonResult json=new JsonResult("testdata",testservice.querytest());
		
		return json;
		
	}

	public String list() throws Exception{
		try{
			this.testlist = testservice.querytest();
			
		}catch(Exception ex){
			ex.printStackTrace();
			throw ex;
		}
		return this.SUCCESS;
	}

	public String add(){
		try{
			this.testservice.addtest(testpojo);
		}catch(Exception ex){
			ex.printStackTrace();
		}
		
		this.forwordaction="test_list";
		return "forwordaction";
	}
}
